.class public Lcom/burstly/lib/component/LayoutParametersResolver;
.super Ljava/lang/Object;
.source "LayoutParametersResolver.java"


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;


# instance fields
.field private final mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

.field private final mResponseData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

.field private mScale:F

.field private final mTag:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 37
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Lcom/burstly/lib/network/beans/ResponseBean;Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;Ljava/lang/String;)V
    .locals 1
    .parameter "fullResponse"
    .parameter "responseData"
    .parameter "logTag"

    .prologue
    .line 68
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 57
    const/high16 v0, 0x3f80

    iput v0, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mScale:F

    .line 69
    iput-object p1, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    .line 70
    iput-object p2, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mResponseData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    .line 71
    iput-object p3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    .line 72
    return-void
.end method

.method private createLayoutParams(Ljava/lang/Integer;Ljava/lang/Integer;)Landroid/widget/FrameLayout$LayoutParams;
    .locals 7
    .parameter "width"
    .parameter "height"

    .prologue
    .line 129
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Width : {0}, height: {1} are passed from server. "

    const/4 v5, 0x2

    new-array v5, v5, [Ljava/lang/Object;

    const/4 v6, 0x0

    aput-object p1, v5, v6

    const/4 v6, 0x1

    aput-object p2, v5, v6

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 130
    if-eqz p1, :cond_0

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result v2

    if-lez v2, :cond_0

    if-eqz p2, :cond_0

    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    if-lez v2, :cond_0

    .line 131
    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result v2

    iget v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mScale:F

    invoke-direct {p0, v2, v3}, Lcom/burstly/lib/component/LayoutParametersResolver;->parseSize(IF)I

    move-result v1

    .line 132
    .local v1, parsedWidth:I
    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    iget v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mScale:F

    invoke-direct {p0, v2, v3}, Lcom/burstly/lib/component/LayoutParametersResolver;->parseSize(IF)I

    move-result v0

    .line 133
    .local v0, parsedHeight:I
    new-instance v2, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v2, v1, v0}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 135
    .end local v0           #parsedHeight:I
    .end local v1           #parsedWidth:I
    :goto_0
    return-object v2

    :cond_0
    const/4 v2, 0x0

    goto :goto_0
.end method

.method private getLayoutParams()Landroid/view/ViewGroup$LayoutParams;
    .locals 9

    .prologue
    const/4 v7, 0x0

    const/4 v8, -0x2

    .line 91
    iget-object v2, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mResponseData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    if-nez v2, :cond_1

    .line 92
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Current ad data has not been set in GS adaptor. Using WRAP_CONTENT..."

    new-array v5, v7, [Ljava/lang/Object;

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 93
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v1, v8, v8}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 117
    :cond_0
    :goto_0
    return-object v1

    .line 96
    :cond_1
    iget-object v2, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mResponseData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    invoke-virtual {v2}, Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;->getAdType()Lcom/burstly/lib/network/beans/ResponseBean$ResponseData$AdType;

    move-result-object v0

    .line 97
    .local v0, adType:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData$AdType;
    const/4 v1, 0x0

    .line 98
    .local v1, params:Landroid/view/ViewGroup$LayoutParams;
    if-eqz v0, :cond_2

    .line 99
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Parsing width and height from AdType..."

    new-array v5, v7, [Ljava/lang/Object;

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 100
    invoke-virtual {v0}, Lcom/burstly/lib/network/beans/ResponseBean$ResponseData$AdType;->getWidth()Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0}, Lcom/burstly/lib/network/beans/ResponseBean$ResponseData$AdType;->getHeight()Ljava/lang/Integer;

    move-result-object v3

    invoke-direct {p0, v2, v3}, Lcom/burstly/lib/component/LayoutParametersResolver;->createLayoutParams(Ljava/lang/Integer;Ljava/lang/Integer;)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    .line 102
    :cond_2
    if-nez v1, :cond_4

    .line 103
    iget-object v2, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    if-nez v2, :cond_3

    .line 104
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Full response has not been set in adaptor. Using WRAP_CONTENT..."

    new-array v5, v7, [Ljava/lang/Object;

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 105
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    .end local v1           #params:Landroid/view/ViewGroup$LayoutParams;
    invoke-direct {v1, v8, v8}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    goto :goto_0

    .line 108
    .restart local v1       #params:Landroid/view/ViewGroup$LayoutParams;
    :cond_3
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Invalid parameters are in AdType. Parsing width and height from Response..."

    new-array v5, v7, [Ljava/lang/Object;

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 109
    iget-object v2, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    invoke-virtual {v2}, Lcom/burstly/lib/network/beans/ResponseBean;->getWidth()Ljava/lang/Integer;

    move-result-object v2

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    invoke-virtual {v3}, Lcom/burstly/lib/network/beans/ResponseBean;->getHeight()Ljava/lang/Integer;

    move-result-object v3

    invoke-direct {p0, v2, v3}, Lcom/burstly/lib/component/LayoutParametersResolver;->createLayoutParams(Ljava/lang/Integer;Ljava/lang/Integer;)Landroid/widget/FrameLayout$LayoutParams;

    move-result-object v1

    .line 111
    :cond_4
    if-nez v1, :cond_0

    .line 112
    sget-object v2, Lcom/burstly/lib/component/LayoutParametersResolver;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v3, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mTag:Ljava/lang/String;

    const-string v4, "Invalid sizes (width : {0}, height: {1}) are passed from server. Using WRAP_CONTENT..."

    const/4 v5, 0x2

    new-array v5, v5, [Ljava/lang/Object;

    iget-object v6, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    invoke-virtual {v6}, Lcom/burstly/lib/network/beans/ResponseBean;->getWidth()Ljava/lang/Integer;

    move-result-object v6

    aput-object v6, v5, v7

    const/4 v6, 0x1

    iget-object v7, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    invoke-virtual {v7}, Lcom/burstly/lib/network/beans/ResponseBean;->getHeight()Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v5, v6

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 114
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    .end local v1           #params:Landroid/view/ViewGroup$LayoutParams;
    invoke-direct {v1, v8, v8}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .restart local v1       #params:Landroid/view/ViewGroup$LayoutParams;
    goto :goto_0
.end method

.method private parseSize(IF)I
    .locals 1
    .parameter "srcSize"
    .parameter "scale"

    .prologue
    .line 146
    if-lez p1, :cond_0

    int-to-float v0, p1

    mul-float/2addr v0, p2

    :goto_0
    float-to-int v0, v0

    return v0

    :cond_0
    const/high16 v0, -0x4000

    goto :goto_0
.end method


# virtual methods
.method public getScale()F
    .locals 1

    .prologue
    .line 155
    iget v0, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mScale:F

    return v0
.end method

.method public resolveParameters()Landroid/view/ViewGroup$LayoutParams;
    .locals 1

    .prologue
    .line 80
    invoke-direct {p0}, Lcom/burstly/lib/component/LayoutParametersResolver;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v0

    return-object v0
.end method

.method public setScale(F)V
    .locals 0
    .parameter "scale"

    .prologue
    .line 164
    iput p1, p0, Lcom/burstly/lib/component/LayoutParametersResolver;->mScale:F

    .line 165
    return-void
.end method
